﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WordNet.Core.ElementContracts;
using WordNet.Core.Relations;

namespace WordNet.Core
{
    public class SenseLexicalResult:ISenseLexicalResult
    {
        IWordID _wordId;
        List<ISynset> _relatedSynsets;
        List<IWord> _relatedWords;
        RelationType _currentRelation;
        Pointer _pointer;
        
         public SenseLexicalResult(IWordID id, List<ISynset> synsets, Pointer pointer)
        {
            _wordId = id;
            _relatedSynsets = synsets;
            _currentRelation = RelationType.Semantic;
            _pointer = pointer;
        }
       
        public SenseLexicalResult(IWordID id, List<IWord> words, Pointer pointer)
        {
            _wordId = id;
            _relatedWords = words;
            _currentRelation = RelationType.Lexical;
            _pointer = pointer;
        }
        
        public string Lemma
        {
            get { return _wordId.Lemma;  }
        }

        public RelationType CurrentRelation
        {
            get { return _currentRelation; }
        }

        public ElementContracts.ISynset[] RelatedSynsets()
        {
            return _relatedSynsets != null ? _relatedSynsets.ToArray() : null;
        }

        public ElementContracts.IWord[] RelatedWords()
        {
            return _relatedWords != null ? _relatedWords.ToArray() : null;
        }

        public Pointer CurrentPointer
        {
            get { return _pointer; }
        }
    }
}
